import config
from time import strftime, gmtime

class Logger():
    def __init__(self):
        ""
        self.verbose_threshold = config.verbose_threshold 
        self.debug_log = self.__opendebuglog()
    def __repr__(self):
        ""
        return "Logger class"
    def __opendebuglog(self):
        if config.debug_log:
            return open(config.log_filename, 'a')
    def WriteDebugLog(self, text):
        now = strftime("%Y-%m-%d %H:%M:%S ", gmtime())
        text = str(text)
        self.debug_log.write(now + text + '\n')
        return 
    def Log(self, text, verbose_level = 1):
        "Stdout at the moment"
        if verbose_level <= self.verbose_threshold:
            print text
        if self.debug_log:
            self.WriteDebugLog(text)
            